package JAVA300.第十一章多线程;

/**
 * 从网页下载文件工具类，将他放在线程里
 */

import com.sun.webkit.network.URLs;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.net.URL;

public class thread_02_webdownload {

    public void download(String url,String name){
        try {
            FileUtils.copyURLToFile(new URL(url),new File(name));
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("下载失败！");
        }
    }
}
